Optimal. Leaf size=63 \[ -x \left (a^2-b^2\right )+\frac{(a+b \tan (c+d x))^3}{3 b d}+\frac{2 a b \log (\cos (c+d x))}{d}-\frac{b^2 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0515594, antiderivative size = 63, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3543, 3477, 3475} \[ -x \left (a^2-b^2\right )+\frac{(a+b \tan (c+d x))^3}{3 b d}+\frac{2 a b \log (\cos (c+d x))}{d}-\frac{b^2 \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3543
Rule 3477
Rule 3475
Rubi steps
\begin{align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac{(a+b \tan (c+d x))^3}{3 b d}-\int (a+b \tan (c+d x))^2 \, dx\\ &=-\left (a^2-b^2\right ) x-\frac{b^2 \tan (c+d x)}{d}+\frac{(a+b \tan (c+d x))^3}{3 b d}-(2 a b) \int \tan (c+d x) \, dx\\ &=-\left (a^2-b^2\right ) x+\frac{2 a b \log (\cos (c+d x))}{d}-\frac{b^2 \tan (c+d x)}{d}+\frac{(a+b \tan (c+d x))^3}{3 b d}\\ \end{align*}
Mathematica [A] time = 0.302023, size = 99, normalized size = 1.57 \[ -\frac{a^2 \tan ^{-1}(\tan (c+d x))}{d}+\frac{a^2 \tan (c+d x)}{d}+\frac{a b \left (\tan ^2(c+d x)+2 \log (\cos (c+d x))\right )}{d}+\frac{b^2 \tan ^3(c+d x)}{3 d}+\frac{b^2 \tan ^{-1}(\tan (c+d x))}{d}-\frac{b^2 \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.005, size = 106, normalized size = 1.7 \begin{align*}{\frac{ \left ( \tan \left ( dx+c \right ) \right ) ^{3}{b}^{2}}{3\,d}}+{\frac{ab \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{d}}+{\frac{{a}^{2}\tan \left ( dx+c \right ) }{d}}-{\frac{{b}^{2}\tan \left ( dx+c \right ) }{d}}-{\frac{ab\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) }{d}}-{\frac{{a}^{2}\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}+{\frac{\arctan \left ( \tan \left ( dx+c \right ) \right ){b}^{2}}{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.59171, size = 105, normalized size = 1.67 \begin{align*} \frac{b^{2} \tan \left (d x + c\right )^{3} + 3 \, a b \tan \left (d x + c\right )^{2} - 3 \, a b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 3 \,{\left (a^{2} - b^{2}\right )}{\left (d x + c\right )} + 3 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{3 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.77385, size = 184, normalized size = 2.92 \begin{align*} \frac{b^{2} \tan \left (d x + c\right )^{3} + 3 \, a b \tan \left (d x + c\right )^{2} - 3 \,{\left (a^{2} - b^{2}\right )} d x + 3 \, a b \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 3 \,{\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{3 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.417101, size = 94, normalized size = 1.49 \begin{align*} \begin{cases} - a^{2} x + \frac{a^{2} \tan{\left (c + d x \right )}}{d} - \frac{a b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac{a b \tan ^{2}{\left (c + d x \right )}}{d} + b^{2} x + \frac{b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac{b^{2} \tan{\left (c + d x \right )}}{d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right )^{2} \tan ^{2}{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 2.17229, size = 911, normalized size = 14.46 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]